//
// Created by Administrator on 2022/1/14.
//

#ifndef OPENGLLEARN_2_UTILS_H
#define OPENGLLEARN_2_UTILS_H

#include "glad/glad.h"
#include "GLFW/glfw3.h"
#include "SOIL2/SOIL2.h"
#include <string>
#include <iostream>
#include <sstream>
#include <fstream>

static constexpr float PI = 3.1415926f;
static constexpr float PI_2 = 6.2831852f;
static constexpr float PI_OVER_2 = 1.5707963f;
static constexpr float DEG_2_RAD = PI / 180.0f;
static constexpr float RAD_2_DEG = 180.0f / PI;

class Utils
{
public:
    static std::string ReadShaderSource(const char* filePath);
    static void PrintShaderLog(GLuint shader, const char* name);
    static void PrintProgramLog(GLuint program);
    static bool CheckOpenGLError();
    static GLuint CreateShaderProgram(const char* vp, const char* fp);
    static GLuint LoadTexture(const char* texImagePath);
    static float Deg2Rad(float deg);
    static float Rad2Deg(float rad);

    // 预定义材质(ADS+Shininess)
    // Gold
    static float* GoldAmbient();
    static float* GoldDiffuse();
    static float* GoldSpecular();
    static float GoldShininess();

    // Silver
    static float* SilverAmbient();
    static float* SilverDiffuse();
    static float* SilverSpecular();
    static float SilverShininess();

    // Bronze
    static float* BronzeAmbient();
    static float* BronzeDiffuse();
    static float* BronzeSpecular();
    static float BronzeShininess();

    // Jade
    static float* JadeAmbient();
    static float* JadeDiffuse();
    static float* JadeSpecular();
    static float JadeShininess();

    // Pearl
    static float* PearlAmbient();
    static float* PearlDiffuse();
    static float* PearlSpecular();
    static float PearlShininess();
};

#endif //OPENGLLEARN_2_UTILS_H
